package com.hongxin.nw.netty.model.analysis.info;

import com.hongxin.nw.netty.utils.BinaryTools;
import com.hongxin.nw.netty.utils.FieldAnalysis;
import com.hongxin.nw.netty.values.TypeIdentif;
import io.netty.buffer.ByteBuf;
import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;

/**
 * @remark A.33充电过程中上传数据(改)
 * @author: GuoXiaolin
 * @date 2019/5/25 17:46
 * @Version 1.0
 * @Descibe
 */
@Slf4j
@Getter
@Setter
public class Mrena1_17_1 {

    private String co;   //    充电设备编号	压缩BCD码	8Byte	充电设备编号
    private String chargeIndex; //    充电接口标识	BIN码	1Byte	充电设备为一桩多充时用来标记接口号，一桩一充时此项为0。多个接口时顺序对每个接口进行编号
    private String tranNum; //    交易流水号	压缩BCD 码	16Byte	32位交易代码
    private String bType; //    业务类型	压缩BCD码	2Byte	0001-充电 0002-放电
    private String uid; //    用户身份ID	压缩BCD码	8Byte	本地充电时，此字段全部填充为FF
    private String physicsNum; //    物理卡号	压缩BCD码	8Byte	远程充电时，此字段全部填充为FF
    private String startTime; //    开始时间	BIN码	7Byte	CP56Time2a格式
    private String endTime; //    结束时间	BIN码	7Byte	CP56Time2a格式
    private String jStartVal; //    尖起示值	BIN码	4Byte	精确到小数点后二位
    private String jEndVal; //    尖止示值	BIN码	4Byte	精确到小数点后二位
    private String fStartVal; //    峰起示值	BIN码	4Byte	精确到小数点后二位
    private String fendVal; //    峰止示值	BIN码	4Byte	精确到小数点后二位
    private String pStartVal; //    平起示值	BIN码	4Byte	精确到小数点后二位
    private String pendVal; //    平止示值	BIN码	4Byte	精确到小数点后二位
    private String gStartVal; //    谷起示值	BIN码	4Byte	精确到小数点后二位
    private String gEndVal; //    谷止示值	BIN码	4Byte	精确到小数点后二位
    private String jEQ; //    尖电量	BIN码	4Byte	精确到小数点后二位
    private String fEQ; //    峰电量	BIN码	4Byte	精确到小数点后二位
    private String pEQ; //    平电量	BIN码	4Byte	精确到小数点后二位
    private String gEQ; //    谷电量	BIN码	4Byte	精确到小数点后二位
    private String zEQ; //    总电量	BIN码	4Byte	精确到小数点后二位
    private String jEF; //    尖电费	BIN码	4Byte	精确到小数点后两位
    private String fEF; //    峰电费	BIN码	4Byte	精确到小数点后两位
    private String pEF; //    平电费	BIN码	4Byte	精确到小数点后两位
    private String gEF; //    谷电费	BIN码	4Byte	精确到小数点后两位
    private String zEF; //    当前总电费	BIN码	4Byte	精确到小数点后两位
    private String szEF; //    服务费总费用	BIN码	4Byte	精确到小数点后两位
    private String zwEF; //    占位费总费用	BIN码	4Byte	精确到小数点后两位
    private String meterType; //    计量示数类型	压缩BCD码	2Byte	0002-充电量 0003-放电量
    private String zStartVal; //    总起示值	BIN码	4Byte	精确到小数点后二位
    private String zEndVal; //    总止示值	BIN码	4Byte	精确到小数点后二位
    private String comTime; //    分时计费标志	压缩BCD码 	1Byte	00：分时 ,01：不分时
    private String carIdentify; //    电动汽车唯一标识	字符	17Byte
    private String chargeTime; //    累计充电时间	BIN码	2Byte	单位：分钟
    private String surplus_time; //    预计剩余充电时间	 BIN码	2Byte	单位：分钟
    private String chargeFee; //    充电总费用	BIN码	4Byte	精确到小数点后两位
    private String startModel;//  启动方式: 1Byte	 刷卡启动：0 , 远程/APP启动：1, VIN启动：2

    private int idx = 0;
    private ByteBuf byteBuf;

    private Mrena1_17_1 subCo() {
//        this.co = substring(TypeIdentif.BYTE_CO.getbyteLength());
//        this.co = FieldAnalysis.analysisBCD(this.co);
//        return this;


//        int byteLength = TypeIdentif.BYTE_CO.getInt();
//        this.co = BinaryTools.subByteBuf(byteLength, idx, byteBuf);
//        this.co = FieldAnalysis.analysisBCD(this.co);
//        this.idx += byteLength;

        this.co = FieldAnalysis.subCo(TypeIdentif.BYTE_CO.getInt(),idx,byteBuf);
        this.idx += TypeIdentif.BYTE_CO.getInt();
        return this;
    }

    private Mrena1_17_1 subChargeIndex() {
//        this.chargeIndex = substring(TypeIdentif.BYTE_CHARGE_INTERFACE_IDENTIFY.getbyteLength());
//        this.chargeIndex = FieldAnalysis.analysisBin(this.chargeIndex);
//        return this;

//        int byteLength = TypeIdentif.BYTE_CHARGE_INTERFACE_IDENTIFY.getInt();
//        this.chargeIndex = BinaryTools.subByteBuf(byteLength, idx, byteBuf);
//        this.chargeIndex = FieldAnalysis.analysisBin(this.chargeIndex);
//        this.idx += byteLength;


        this.chargeIndex = FieldAnalysis.subGun(TypeIdentif.BYTE_CHARGE_INTERFACE_IDENTIFY.getInt(),idx,byteBuf);
        this.idx += TypeIdentif.BYTE_CHARGE_INTERFACE_IDENTIFY.getInt();
        return this;
    }

    private Mrena1_17_1 subTranNum() {
//        this.tranNum = substring(TypeIdentif.BYTE_TRAN_NUM.getbyteLength());
//        this.tranNum = FieldAnalysis.analysisBCD(this.tranNum);
//        return this;

//        int byteLength = TypeIdentif.BYTE_TRAN_NUM.getInt();
//        this.tranNum = BinaryTools.subByteBuf(byteLength, idx, byteBuf);
//        this.tranNum = FieldAnalysis.analysisBCD(this.tranNum);
//        this.idx += byteLength;

        this.tranNum = FieldAnalysis.subTranNum(TypeIdentif.BYTE_TRAN_NUM.getInt(),idx,byteBuf);
        this.idx += TypeIdentif.BYTE_TRAN_NUM.getInt();
        return this;
    }

    private Mrena1_17_1 subBuisType() {
//        this.buisType = substring(TypeIdentif.BYTE_BUSY_TYPE.getbyteLength());
//        this.buisType = FieldAnalysis.analysisBCD(this.buisType);
//        return this;

        int byteLength = TypeIdentif.BYTE_BUSY_TYPE.getInt();
        this.bType = BinaryTools.subByteBuf(byteLength, idx, byteBuf);
        this.bType = FieldAnalysis.analysisBCD(this.bType);
        this.idx += byteLength;
        return this;

    }

    private Mrena1_17_1 subUid() {
//        this.uid = substring(TypeIdentif.BYTE_USER_ID.getbyteLength());
//        this.uid = FieldAnalysis.analysisBCD(this.uid);
//        return this;

        int byteLength = TypeIdentif.BYTE_USER_ID.getInt();
        this.uid = BinaryTools.subByteBuf(byteLength, idx, byteBuf);
        this.uid = FieldAnalysis.analysisBCD(this.uid);
        this.idx += byteLength;
        return this;
    }

    private Mrena1_17_1 subPhysicsNum() {
//        this.physicsNum =substring(TypeIdentif.BYTE_PHYSICS_NUM.getbyteLength());
//        this.physicsNum = FieldAnalysis.analysisBCD(this.physicsNum);
//        return this;

        int byteLength = TypeIdentif.BYTE_PHYSICS_NUM.getInt();
        this.physicsNum = BinaryTools.subByteBuf(byteLength, idx, byteBuf);
        this.physicsNum = FieldAnalysis.analysisBCD(this.physicsNum);
        this.idx += byteLength;
        return this;
    }

    private Mrena1_17_1 subStarttime() {
//        this.starttime = substring(TypeIdentif.BYTE_START_TIME.getbyteLength());
//        this.starttime = FieldAnalysis.hexToTime(this.starttime);
//        return this;

        int byteLength = TypeIdentif.BYTE_START_TIME.getInt();
        this.startTime = BinaryTools.subByteBuf(byteLength, idx, byteBuf);
        this.startTime = FieldAnalysis.hexToTime(this.startTime);
        this.idx += byteLength;
        return this;
    }

    private Mrena1_17_1 subEndtime() {
//        this.endtime = substring(TypeIdentif.BYTE_END_TIME.getbyteLength());
//        this.endtime = FieldAnalysis.hexToTime(this.endtime);
//        return this;

        int byteLength = TypeIdentif.BYTE_END_TIME.getInt();
        this.endTime = BinaryTools.subByteBuf(byteLength, idx, byteBuf);
        this.endTime = FieldAnalysis.hexToTime(this.endTime);
        this.idx += byteLength;
        return this;
    }

    private Mrena1_17_1 subjStartVal() {
//        this.jStartVal = substring(TypeIdentif.BYTE_J_START_VAL.getbyteLength());
//        this.jStartVal = FieldAnalysis.hexToDecimal(this.jStartVal, 2);
//        return this;

        int byteLength = TypeIdentif.BYTE_J_START_VAL.getInt();
        this.jStartVal = BinaryTools.subByteBuf(byteLength, idx, byteBuf);
        this.jStartVal = FieldAnalysis.hexToDecimal(this.jStartVal,2);
        this.idx += byteLength;
        return this;
    }

    private Mrena1_17_1 subJendVal() {
//        this.jendVal = substring(TypeIdentif.BYTE_J_END_VAL.getbyteLength());
//        this.jendVal = FieldAnalysis.hexToDecimal(this.jendVal, 2);
//        return this;

        int byteLength = TypeIdentif.BYTE_J_END_VAL.getInt();
        this.jEndVal = BinaryTools.subByteBuf(byteLength, idx, byteBuf);
        this.jEndVal = FieldAnalysis.hexToDecimal(this.jEndVal,2);
        this.idx += byteLength;
        return this;
    }

    private Mrena1_17_1 subfStartVal() {
//        this.fStartVal = substring(TypeIdentif.BYTE_F_START_VAL.getbyteLength());
//        this.fStartVal = FieldAnalysis.hexToDecimal(this.fStartVal, 2);
//        return this;

        int byteLength = TypeIdentif.BYTE_F_START_VAL.getInt();
        this.fStartVal = BinaryTools.subByteBuf(byteLength, idx, byteBuf);
        this.fStartVal = FieldAnalysis.hexToDecimal(this.fStartVal,2);
        this.idx += byteLength;
        return this;
    }

    private Mrena1_17_1 fendVal() {
//        this.fendVal = substring(TypeIdentif.BYTE_F_END_VAL.getbyteLength());
//        this.fendVal = FieldAnalysis.hexToDecimal(this.fendVal, 2);
//        return this;

        int byteLength = TypeIdentif.BYTE_F_END_VAL.getInt();
        this.fendVal = BinaryTools.subByteBuf(byteLength, idx, byteBuf);
        this.fendVal = FieldAnalysis.hexToDecimal(this.fendVal,2);
        this.idx += byteLength;
        return this;
    }

    private Mrena1_17_1 subpStartVal() {
//        this.pStartVal = substring(TypeIdentif.BYTE_P_START_VAL.getbyteLength());
//        this.pStartVal = FieldAnalysis.hexToDecimal(this.pStartVal, 2);
//        return this;

        int byteLength = TypeIdentif.BYTE_P_START_VAL.getInt();
        this.pStartVal = BinaryTools.subByteBuf(byteLength, idx, byteBuf);
        this.pStartVal = FieldAnalysis.hexToDecimal(this.pStartVal,2);
        this.idx += byteLength;
        return this;
    }

    private Mrena1_17_1 subPendVal() {
//        this.pendVal = substring(TypeIdentif.BYTE_P_END_VAL.getbyteLength());
//        this.pendVal = FieldAnalysis.hexToDecimal(this.pendVal, 2);
//        return this;

        int byteLength = TypeIdentif.BYTE_P_END_VAL.getInt();
        this.pendVal = BinaryTools.subByteBuf(byteLength, idx, byteBuf);
        this.pendVal = FieldAnalysis.hexToDecimal(this.pendVal,2);
        this.idx += byteLength;
        return this;
    }

    private Mrena1_17_1 subgStartVal() {
//        this.gStartVal = substring(TypeIdentif.BYTE_G_START_VAL.getbyteLength());
//        this.gStartVal = FieldAnalysis.hexToDecimal(this.gStartVal, 2);
//        return this;

        int byteLength = TypeIdentif.BYTE_G_START_VAL.getInt();
        this.gStartVal = BinaryTools.subByteBuf(byteLength, idx, byteBuf);
        this.gStartVal = FieldAnalysis.hexToDecimal(this.gStartVal,2);
        this.idx += byteLength;
        return this;
    }

    private Mrena1_17_1 subGendVal() {
//        this.gendVal = substring(TypeIdentif.BYTE_G_END_VAL.getbyteLength());
//        this.gendVal = FieldAnalysis.hexToDecimal(this.gendVal, 2);
//        return this;

        int byteLength = TypeIdentif.BYTE_G_END_VAL.getInt();
        this.gEndVal = BinaryTools.subByteBuf(byteLength, idx, byteBuf);
        this.gEndVal = FieldAnalysis.hexToDecimal(this.gEndVal,2);
        this.idx += byteLength;
        return this;
    }

    private Mrena1_17_1 subjEQ() {
//        this.jEQ = substring(TypeIdentif.BYTE_J_EQ.getbyteLength());
//        this.jEQ = FieldAnalysis.hexToDecimal(this.jEQ, 2);
//        return this;

        int byteLength = TypeIdentif.BYTE_J_EQ.getInt();
        this.jEQ = BinaryTools.subByteBuf(byteLength, idx, byteBuf);
        this.jEQ = FieldAnalysis.hexToDecimal(this.jEQ,2);
        this.idx += byteLength;
        return this;
    }

    private Mrena1_17_1 subfEQ() {
//        this.fEQ = substring(TypeIdentif.BYTE_F_EQ.getbyteLength());
//        this.fEQ = FieldAnalysis.hexToDecimal(this.fEQ, 2);
//        return this;

        int byteLength = TypeIdentif.BYTE_F_EQ.getInt();
        this.fEQ = BinaryTools.subByteBuf(byteLength, idx, byteBuf);
        this.fEQ = FieldAnalysis.hexToDecimal(this.fEQ,2);
        this.idx += byteLength;
        return this;
    }

    private Mrena1_17_1 subpEQ() {
//        this.pEQ = substring(TypeIdentif.BYTE_P_EQ.getbyteLength());
//        this.pEQ = FieldAnalysis.hexToDecimal(this.pEQ, 2);
//        return this;

        int byteLength = TypeIdentif.BYTE_P_EQ.getInt();
        this.pEQ = BinaryTools.subByteBuf(byteLength, idx, byteBuf);
        this.pEQ = FieldAnalysis.hexToDecimal(this.pEQ,2);
        this.idx += byteLength;
        return this;
    }

    private Mrena1_17_1 subgEQ() {
//        this.gEQ = substring(TypeIdentif.BYTE_G_EQ.getbyteLength());
//        this.gEQ = FieldAnalysis.hexToDecimal(this.gEQ, 2);
//        return this;

        int byteLength = TypeIdentif.BYTE_G_EQ.getInt();
        this.gEQ = BinaryTools.subByteBuf(byteLength, idx, byteBuf);
        this.gEQ = FieldAnalysis.hexToDecimal(this.gEQ,2);
        this.idx += byteLength;
        return this;
    }

    private Mrena1_17_1 subzEQ() {
//        this.zEQ = substring(TypeIdentif.BYTE_Z_EQ.getbyteLength());
//        this.zEQ = FieldAnalysis.hexToDecimal(this.zEQ, 2);
//        return this;

        int byteLength = TypeIdentif.BYTE_Z_EQ.getInt();
        this.zEQ = BinaryTools.subByteBuf(byteLength, idx, byteBuf);
        this.zEQ = FieldAnalysis.hexToDecimal(this.zEQ,2);
        this.idx += byteLength;
        return this;
    }

    private Mrena1_17_1 subjEF() {
//        this.jEF = substring(TypeIdentif.BYTE_J_EF.getbyteLength());
//        this.jEF = FieldAnalysis.hexToDecimal(this.jEF, 2);
//        return this;

        int byteLength = TypeIdentif.BYTE_J_EF.getInt();
        this.jEF = BinaryTools.subByteBuf(byteLength, idx, byteBuf);
        this.jEF = FieldAnalysis.hexToDecimal(this.jEF,2);
        this.idx += byteLength;
        return this;
    }

    private Mrena1_17_1 subfEF() {
//        this.fEF = substring(TypeIdentif.BYTE_F_EF.getbyteLength());
//        this.fEF = FieldAnalysis.hexToDecimal(this.fEF, 2);
//        return this;

        int byteLength = TypeIdentif.BYTE_F_EF.getInt();
        this.fEF = BinaryTools.subByteBuf(byteLength, idx, byteBuf);
        this.fEF = FieldAnalysis.hexToDecimal(this.fEF,2);
        this.idx += byteLength;
        return this;
    }

    private Mrena1_17_1 subpEF() {
//        this.pEF = substring(TypeIdentif.BYTE_P_EF.getbyteLength());
//        this.pEF = FieldAnalysis.hexToDecimal(this.pEF, 2);
//        return this;

        int byteLength = TypeIdentif.BYTE_P_EF.getInt();
        this.pEF = BinaryTools.subByteBuf(byteLength, idx, byteBuf);
        this.pEF = FieldAnalysis.hexToDecimal(this.pEF,2);
        this.idx += byteLength;
        return this;
    }

    private Mrena1_17_1 subgEF() {
//        this.gEF = substring(TypeIdentif.BYTE_G_EF.getbyteLength());
//        this.gEF = FieldAnalysis.hexToDecimal(this.gEF, 2);
//        return this;

        int byteLength = TypeIdentif.BYTE_G_EF.getInt();
        this.gEF = BinaryTools.subByteBuf(byteLength, idx, byteBuf);
        this.gEF = FieldAnalysis.hexToDecimal(this.gEF,2);
        this.idx += byteLength;
        return this;
    }

    private Mrena1_17_1 subzEF() {
//        this.zEF = substring(TypeIdentif.BYTE_Z_EF.getbyteLength());
//        this.zEF = FieldAnalysis.hexToDecimal(this.zEF, 2);
//        return this;

        int byteLength = TypeIdentif.BYTE_Z_EF.getInt();
        this.zEF = BinaryTools.subByteBuf(byteLength, idx, byteBuf);
        this.zEF = FieldAnalysis.hexToDecimal(this.zEF,2);
        this.idx += byteLength;
        return this;
    }

    private Mrena1_17_1 subSzEF() {
//        this.szEF = substring(TypeIdentif.BYTE_S_Z_EF.getbyteLength());
//        this.szEF = FieldAnalysis.hexToDecimal(this.szEF, 2);
//        return this;

        int byteLength = TypeIdentif.BYTE_S_Z_EF.getInt();
        this.szEF = BinaryTools.subByteBuf(byteLength, idx, byteBuf);
        this.szEF = FieldAnalysis.hexToDecimal(this.szEF,2);
        this.idx += byteLength;
        return this;
    }

    private Mrena1_17_1 subZwEF() {
//        this.zwEF = substring(TypeIdentif.BYTE_Z_W_EF.getbyteLength());
//        this.zwEF = FieldAnalysis.hexToDecimal(this.zwEF, 2);
//        return this;

        int byteLength = TypeIdentif.BYTE_Z_W_EF.getInt();
        this.zwEF = BinaryTools.subByteBuf(byteLength, idx, byteBuf);
        this.zwEF = FieldAnalysis.hexToDecimal(this.zwEF,2);
        this.idx += byteLength;
        return this;
    }

    private Mrena1_17_1 subMeterType() {
//        this.metertype = substring(TypeIdentif.BYTE_METER_I_TYPE.getbyteLength());
//        this.metertype = FieldAnalysis.analysisBCD(this.metertype);
//        return this;

        int byteLength = TypeIdentif.BYTE_METER_I_TYPE.getInt();
        this.meterType = BinaryTools.subByteBuf(byteLength, idx, byteBuf);
        this.meterType = FieldAnalysis.analysisBCD(this.meterType);
        this.idx += byteLength;
        return this;
    }

    private Mrena1_17_1 subzStartVal() {
//        this.zStartVal =substring(TypeIdentif.BYTE_Z_START_VAL.getbyteLength());
//        this.zStartVal = FieldAnalysis.hexToDecimal(this.zStartVal, 2);
//        return this;

        int byteLength = TypeIdentif.BYTE_Z_START_VAL.getInt();
        this.zStartVal = BinaryTools.subByteBuf(byteLength, idx, byteBuf);
        this.zStartVal = FieldAnalysis.hexToDecimal(this.zStartVal,2);
        this.idx += byteLength;
        return this;
    }

    private Mrena1_17_1 subzEndVal() {
//        this.zEndVal = substring(TypeIdentif.BYTE_Z_END_VAL.getbyteLength());
//        this.zEndVal = FieldAnalysis.hexToDecimal(this.zEndVal,2);
//        return this;

        int byteLength = TypeIdentif.BYTE_Z_END_VAL.getInt();
        this.zEndVal = BinaryTools.subByteBuf(byteLength, idx, byteBuf);
        this.zEndVal = FieldAnalysis.hexToDecimal(this.zEndVal,2);
        this.idx += byteLength;
        return this;
    }

    private Mrena1_17_1 subA() {
//        this.a = substring(TypeIdentif.BYTE_TIME_BILLING_IDENTIFY.getbyteLength());
//        this.a = FieldAnalysis.analysisBCD(this.a);
//        return this;

        int byteLength = TypeIdentif.BYTE_TIME_BILLING_IDENTIFY.getInt();
        this.comTime = BinaryTools.subByteBuf(byteLength, idx, byteBuf);
        this.comTime = FieldAnalysis.analysisBCD(this.comTime);
        this.idx += byteLength;
        return this;
    }

    private Mrena1_17_1 subCarIdentify() {
//        this.caridentify = substring(TypeIdentif.BYTE_CAR_IDENTIFY.getbyteLength());
//        this.caridentify = FieldAnalysis.caseVin(this.caridentify);
//        return this;

        int byteLength = TypeIdentif.BYTE_CAR_IDENTIFY.getInt();
        this.carIdentify = BinaryTools.subByteBufToVIN(byteLength, idx, byteBuf);
//        this.caridentify = FieldAnalysis.caseVin(this.caridentify);
        this.idx += byteLength;
        return this;
    }

    private Mrena1_17_1 subChargeTime() {
//        this.chargeTime = substring(TypeIdentif.BYTE_CUMULATIVE_CHARGE_TIME.getbyteLength());
//        this.chargeTime = FieldAnalysis.analysisBin(this.chargeTime);
//        return this;

        int byteLength = TypeIdentif.BYTE_CUMULATIVE_CHARGE_TIME.getInt();
        this.chargeTime = BinaryTools.subByteBuf(byteLength, idx, byteBuf);
        this.chargeTime = FieldAnalysis.analysisBin(this.chargeTime);
        this.idx += byteLength;
        return this;
    }

    private Mrena1_17_1 subSurplus_time() {
//        this.surplus_time = substring(TypeIdentif.BYTE_SURPLUS_TIME.getbyteLength());
//        this.surplus_time = FieldAnalysis.analysisBin(this.surplus_time);
//        return this;

        int byteLength = TypeIdentif.BYTE_SURPLUS_TIME.getInt();
        this.surplus_time = BinaryTools.subByteBuf(byteLength, idx, byteBuf);
        this.surplus_time = FieldAnalysis.analysisBin(this.surplus_time);
        this.idx += byteLength;
        return this;
    }

    private Mrena1_17_1 subChargeFee() {
//        this.chargeFee =substring(TypeIdentif.BYTE_CHARGE_FEE.getbyteLength());
//        this.chargeFee = FieldAnalysis.hexToDecimal(this.chargeFee, 2);
//        return this;

        int byteLength = TypeIdentif.BYTE_CHARGE_FEE.getInt();
        this.chargeFee = BinaryTools.subByteBuf(byteLength, idx, byteBuf);
        this.chargeFee = FieldAnalysis.hexToDecimal(this.chargeFee,2);
        this.idx += byteLength;
        return this;
    }
    private Mrena1_17_1 subStartModel() {
//        this.startModel =substring(TypeIdentif.BYTE_START_MODEL.getbyteLength());
//        this.startModel = FieldAnalysis.analysisBCD(this.startModel);
//        return this;

        int byteLength = TypeIdentif.BYTE_START_MODEL.getInt();
        this.startModel = BinaryTools.subByteBuf(byteLength, idx, byteBuf);
        this.startModel = FieldAnalysis.analysisBCD(this.startModel);
        this.idx += byteLength;
        return this;
    }

    public Mrena1_17_1 analysisStr(int idx, ByteBuf byteBuf) {
        this.idx = idx;
        this.byteBuf = byteBuf;

        return this.subCo()
                .subChargeIndex()
                .subTranNum()
                .subBuisType()
                .subUid()
                .subPhysicsNum()
                .subStarttime()
                .subEndtime()
                .subjStartVal()
                .subJendVal()
                .subfStartVal()
                .fendVal()
                .subpStartVal()
                .subPendVal()
                .subgStartVal()
                .subGendVal()
                .subjEQ()
                .subfEQ().subpEQ()
                .subgEQ().subzEQ()
                .subjEF().subfEF()
                .subpEF().subgEF()
                .subzEF().subSzEF()
                .subZwEF().subMeterType()
                .subzStartVal()
                .subzEndVal().subA()
                .subCarIdentify().subChargeTime()
                .subSurplus_time().subChargeFee()
                .subStartModel();
    }


    @Override
    public String toString() {
        return "Mrena1_17_1{" +
                "co='" + co + '\'' +
                ", chargeIndex='" + chargeIndex + '\'' +
                ", tranNum='" + tranNum + '\'' +
                ", bType='" + bType + '\'' +
                ", uid='" + uid + '\'' +
                ", physicsNum='" + physicsNum + '\'' +
                ", startTime='" + startTime + '\'' +
                ", endTime='" + endTime + '\'' +
                ", jStartVal='" + jStartVal + '\'' +
                ", jEndVal='" + jEndVal + '\'' +
                ", fStartVal='" + fStartVal + '\'' +
                ", fendVal='" + fendVal + '\'' +
                ", pStartVal='" + pStartVal + '\'' +
                ", pendVal='" + pendVal + '\'' +
                ", gStartVal='" + gStartVal + '\'' +
                ", gEndVal='" + gEndVal + '\'' +
                ", jEQ='" + jEQ + '\'' +
                ", fEQ='" + fEQ + '\'' +
                ", pEQ='" + pEQ + '\'' +
                ", gEQ='" + gEQ + '\'' +
                ", zEQ='" + zEQ + '\'' +
                ", jEF='" + jEF + '\'' +
                ", fEF='" + fEF + '\'' +
                ", pEF='" + pEF + '\'' +
                ", gEF='" + gEF + '\'' +
                ", zEF='" + zEF + '\'' +
                ", szEF='" + szEF + '\'' +
                ", zwEF='" + zwEF + '\'' +
                ", MeterType='" + meterType + '\'' +
                ", zStartVal='" + zStartVal + '\'' +
                ", zEndVal='" + zEndVal + '\'' +
                ", comTime='" + comTime + '\'' +
                ", CarIdentify='" + carIdentify + '\'' +
                ", chargeTime='" + chargeTime + '\'' +
                ", Surplus_time='" + surplus_time + '\'' +
                ", chargeFee='" + chargeFee + '\'' +
                ", startModel='" + startModel + '\'' +
                '}';
    }

}
